Skip to content

id-core: configured bare-string shorthand (A9119) - #11940

Merged
dezren39 merged 1 commit into
mainfrom
shorthand-policy
Nov 18, 2026
Merged

dezren39 merged 1 commit into
mainfrom
shorthand-policy

Conversation

@dezren39

@dezren39 dezren39 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Refs #10261

Before: nothing turned a bare string like name into an array address, and nothing stopped a caller from assuming the design's example index 2.

After: id_core::array_shorthand (not yet exported; the crate-root export belongs to slice 9110-02) expands a bare string from configuration only. With default_slot = 2, name becomes [null, null, utf8("name")]. With no policy configured, expansion fails as missing_shorthand_policy; there is no fallback index anywhere in the code.

How:

  • ShorthandPolicy::new(default_slot) carries prefix_fill: Null and text_encoding: Utf8, the only values A-9119.1 admits, as enums so they can grow.
  • ShorthandConfig holds per-namespace defaults and per-server overrides keyed by (RegistryId, NamespaceId) from the Define local namespace registry record and two-core constraint #10243 record. policy_for(server, ns) returns that server's override where one is set, else the namespace default, else the error. Another server's override never applies.
  • ShorthandConfig::expand(server, definition, text) refuses a content-core namespace as shorthand_requires_array_core.
  • An index too large to allocate fails as expansion_too_large via try_reserve_exact, so there is no fixed maximum and no abort.

Tests (cargo test -p id-core --test array_shorthand, 8 tests): the design example, unset-policy error, override scoping (including a handle registry with the same text as a server), content-core refusal, exact UTF-8 bytes, and a proptest that runs up to 40 generated set, clear and expand operations against a plain association-list model and compares every result and error class.


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Slice A9119-shorthand-policy, design A-9119.1 (S4.29-S4.33). Adds
array_shorthand.rs: a ShorthandPolicy {default_slot, prefix_fill: Null,
text_encoding: Utf8} expands a bare string to default_slot null slots
then its UTF-8 bytes. Policies are set per namespace and overridden per
server; a server override wins only on its own server, an unset policy
is missing_shorthand_policy with no fallback index, and content-core
namespaces refuse shorthand.

Tests compare generated configuration operations against a reference
model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 requested a review from a team as a code owner November 18, 2026 22:03
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c2b47d9f-ab59-4f26-b9b2-256adfefe952
Commits

Reviewing files that changed from the base of the PR and between 308af91 and 310bcd5.

Files selected for processing: 2

  • pkgs/id/crates/id-core/src/array_shorthand.rs
  • pkgs/id/crates/id-core/tests/array_shorthand.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T22:05:20.091424Z 310bcd5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 2273904 into main Nov 18, 2026
1 check passed
@dezren39
dezren39 deleted the shorthand-policy branch November 18, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants